import jmespath
import requests

from api.login import Login

'''平台端   用户管理'''
class PlatformUser(Login):




    def user_list(self,phone_number):
        '''平台端 用户搜索'''
        data = {
            'method': 'get',
            'url' :  '/api/admin/platform/user/list',
            'headers' : {'authori-zation': self.platform_token,},
            'params' : {
                'tagIds': '',
                'sex': '',
                'registerType': '',
                'payCount': '',
                'accessType': '0',
                'dateLimit': '',
                'nikename': '',
                'phone': phone_number,
                'page': '1',
                'limit': '20',
                'temp': '1719803047',
            }
        }
        return self.send_platform_reuqest(data)





    def user_tag(self):
        '''平台端 用户注册类型查询'''
        data = {
            'method': 'get',
            'url' : '/api/admin/platform/user/tag/all/list',
            'headers' : {'authori-zation': self.platform_token},
            'params' : {'temp': '1719804800',},
        }
        return self.send_platform_reuqest(data)



    def user_operate_integer(self,uid,integral,operateType='add'):
        '''平台端 修改用户积分'''
        data = {
            'method': 'get',
            'url' : '/api/admin/platform/user/operate/integer',
            'headers' : {'authori-zation': self.platform_token,},
            'params' : {
                'integral': integral,
                'operateType': operateType,
                'uid': uid,
                'temp': '1719803994',
            }
        }
        return self.send_platform_reuqest(data)



    def user_operate_balance(self,uid,money,operateType='add'):
        '''平台端 修改用户余额'''
        data = {
            'method': 'get',
            'url' : '/api/admin/platform/user/operate/balance',
            'headers' : {'authori-zation': self.platform_token},
            'params' : {
                'operateType': operateType,
                'uid': uid,
                'money': money,
                'temp': '1719803282',
            }
        }
        return self.send_platform_reuqest(data)


# if __name__ == '__main__':
#     print(PlatformUser().user_tag())